﻿using System.Windows.Controls;
using Xioa_UI.Interface;

namespace Xioa_UI.Service;

public class ModelBase
{
    
}


public class ViewLocator : IDataViewTemplate
{
    public Control? Build(object? param)
    {
        if (param is null)
            return null;

        if (param.GetType().Name is not "String")
            return new Label() { Content = "Not Found: " };
        var name = param.ToString();
        var type = Type.GetType("" + name + "Page");

        if (type != null)
        {
            var control = (Control)Activator.CreateInstance(type)!;
            return control;
        }

        return new Label() { Content = "Not Found: " + name };
    }

    public bool Match(object? data)
    {
        return data is ModelBase;
    }
}